﻿using System;
using System.Threading;
using Microsoft.SPOT;

/*
 * Original Gadgeteer framework Copyright (c) Microsoft Corporation. (http://gadgeteer.codeplex.com/)
 * 
 * Gadgeteer Light made by Stefan Thoolen (http://gadgeteerlight.codeplex.com/)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
namespace Seeed_Temperature_and_Humidity
{
    public class Program
    {
        public static void Main()
        {
            int socket = 1;

            Gadgeteer.Modules.Seeed.TemperatureHumidity Temp = new Gadgeteer.Modules.Seeed.TemperatureHumidity(socket);
            Temp.MeasurementComplete += new Gadgeteer.Modules.Seeed.TemperatureHumidity.MeasurementCompleteEventHandler(Temp_MeasurementComplete);

            Temp.StartContinuousMeasurements();

            Thread.Sleep(Timeout.Infinite);
        }

        static void Temp_MeasurementComplete(Gadgeteer.Modules.Seeed.TemperatureHumidity sender, double temperature, double relativeHumidity)
        {
            Debug.Print(temperature.ToString() + " -- " + relativeHumidity.ToString());
        }

    }
}
